﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Adams.Public.Web.Business.Web.Areas.Membership.Donations
{
    public class Donate
    {
        public static Adams.Public.DataTransfer.Web.Areas.Membership.Donations.Donate.PageLoad PageLoad(string bucketId, string token)
        {
            var input = new Adams.Public.DataTransfer.MemberInfo()
            {
                Token = token
            };

            var data = Api.GetData<Adams.Public.DataTransfer.Donations.HasValidCreditCard>("Donations/HasValidCreditCard", input);
            var data2 = Api.GetData<Adams.Shared.Entities.Donations.Bucket>("Donations/GetBucket", new Public.DataTransfer.Donations.GetBucketInput() { 
                BucketID = bucketId
            });

            var model = new Adams.Public.DataTransfer.Web.Areas.Membership.Donations.Donate.PageLoad();

            model.HasValidCreditCard = data.IsValid;
            model.Bucket = data2;

            return model;
        }

        public static Adams.Public.DataTransfer.FormOutput SaveDonation(Adams.Public.DataTransfer.Web.Areas.Membership.Donations.Donate.FormInput input)
        {
            var model = Api.GetData<DataTransfer.FormOutput>("Web/Membership/Donations/SaveDonation", input);
            return model;
        }
    }
}
